<?php
namespace app\model\mysql;

use think\Model;

class Admin extends Model{
    protected $name = "admin";

    public function getInfoByUsername($username = "") {
        if (empty($username)) {
            return null;
        }

        $admin = $this->where("username", $username)->find();

        return $admin;
    }

    public function updateLoginInfo($id, $data = []) : bool {
        $id = intval($id);
        if (empty($id) || empty($data)) {
            return false;
        }

        return $this->where("id", $id)->save($data);
    }
}